import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
// 引入Parse第三方库
import * as Parse from "parse"
(Parse as any).serverURL = "http://metapunk.cn:9999/parse"
Parse.initialize("dev")
@Component({
  selector: 'app-page-detail',
  templateUrl: './page-detail.component.html',
  styleUrls: ['./page-detail.component.scss']
})
export class PageDetailComponent {
  foodList:any={}
  constructor(private route:ActivatedRoute){
    this.route.params.subscribe(params=>{
      // console.log(params)
      let id=params['id']
      this.showSort(id)
    })
  }
  // foodList:any=[]
  // async showSort(item:any){
  //   let query = new Parse.Query("Goods")
  //   query.equalTo("objectId",item) 
  //   // console.log(item);
  //   let list =await query.find()
  //   // list=query.toJSON()
  //   // console.log(list[0]);
  //   list.forEach(item=>{console.log(item)});

  //   this.foodList = list 
  //   // console.log(this.List);

  async showSort(item:any){
    // console.log(item);
    let query = new Parse.Query("Goods")
    // query.limit(9); // 参考：https://docs.parseplatform.org/js/guide/#basic-queries
    query.equalTo("objectId",item)
    let list = await query.find()
    this.foodList = list[0] 
    // console.log(this.foodList);
    
    
  }
}
